/**
 * Project: complex.spring.advance
 * 
 * File Created at 2010-4-20
 * $Id$
 * 
 * Copyright 2008 Alibaba.com Croporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Alibaba Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Alibaba.com.
 */
package com.complex.spring.advance.service.impl;

import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import com.complex.spring.advance.service.ITestA;
import com.complex.spring.advance.service.ITestB;
import com.complex.spring.advance.service.ITestC;
import com.complex.spring.advance.service.ITestF;

/**
 * @description:构造,setter混合注入
 * @author gaoliang
 * @date 2010-4-20
 * @version 1.0
 */
public class TestCImpl implements ITestC {
    private String              arg1;
    private ITestA              testA;
    private TestDImpl           testDImpl; //内部bean
    private int                 arg2;

    private TestEImpl           testE;

    //各种类型注入
    private List<ITestA>        testAList;
    private Set<ITestB>         testBSet;
    private Map<String, Object> testMap;
    private Properties          props;     //此于也可以使用map
    //private Map props

    private ITestF              testF;     //由FactoryBean生成的bean

    //配合spring 构造注入
    public TestCImpl(ITestA testA, String arg1) {
        this.testA = testA;
        this.arg1 = arg1;
    }

    public TestCImpl(String arg1, int arg2) {
        this.arg1 = arg1;
        this.arg2 = arg2;
    }

    @SuppressWarnings("unchecked")
    public void print() {
        System.out.println("this is TestC");
        System.out.println("constructor arg ==>");
        System.out.println("arg1:" + arg1);
        testA.print();
        System.out.println("property ==>");
        System.out.println("arg2:" + arg2);
        System.out.println("internal bean ==>");
        testDImpl.print();
        System.out.println("list ==>");
        for (ITestA testA : testAList) {
            testA.print();
        }
        System.out.println("set ==>");
        for (ITestB testB : testBSet) {
            testB.print();
        }
        System.out.println("map ==>");
        System.out.println(testMap.get("a"));
        ITestA testa = (ITestA) testMap.get("b");
        testa.print();
        ITestB testb = (ITestB) testMap.get("c");
        testb.print();
        List<String> list = (List) testMap.get("d");
        for (String str : list) {
            System.out.println(str);
        }
        System.out.println("props ==>");
        System.out.println(props.get("a"));
        System.out.println(props.get("b"));
        System.out.println("parent ==>");
        System.out.println(testE.getE());
        
        System.out.println("FactoryBean ==>");
        testF.print();
    }

    public String getArg1() {
        return arg1;
    }

    public void setArg1(String arg1) {
        this.arg1 = arg1;
    }

    public ITestA getTestA() {
        return testA;
    }

    public void setTestA(ITestA testA) {
        this.testA = testA;
    }

    public int getArg2() {
        return arg2;
    }

    public void setArg2(int arg2) {
        this.arg2 = arg2;
    }

    public TestDImpl getTestDImpl() {
        return testDImpl;
    }

    public void setTestDImpl(TestDImpl testDImpl) {
        this.testDImpl = testDImpl;
    }

    public List<ITestA> getTestAList() {
        return testAList;
    }

    public void setTestAList(List<ITestA> testAList) {
        this.testAList = testAList;
    }

    public Set<ITestB> getTestBSet() {
        return testBSet;
    }

    public void setTestBSet(Set<ITestB> testBSet) {
        this.testBSet = testBSet;
    }

    public Map<String, Object> getTestMap() {
        return testMap;
    }

    public void setTestMap(Map<String, Object> testMap) {
        this.testMap = testMap;
    }

    public Properties getProps() {
        return props;
    }

    public void setProps(Properties props) {
        this.props = props;
    }

    public TestEImpl getTestE() {
        return testE;
    }

    public void setTestE(TestEImpl testE) {
        this.testE = testE;
    }

    public ITestF getTestF() {
        return testF;
    }

    public void setTestF(ITestF testF) {
        this.testF = testF;
    }

}
